﻿USE master
GO
CREATE DATABASE test ON PRIMARY
(
    NAME='test',
    FILENAME='d:\test_data.mdf', 
    SIZE=5mb,
    MAXSIZE=500MB, 
    filegrowth=15% 
)
LOG ON
(
    name='test_log',
    filename='d:\test_log.ldf',
    SIZE=5MB,
    filegrowth=0 
)
GO

USE test
go
create table Dormitory
(
	id int identity(1,1) primary key,
	s_no nvarchar(30) not null,
	s_name nvarchar(20) not null,
	s_sex int not null,
	s_class nvarchar(20) not null,
	s_dept nvarchar(15) not null,
	d_doorno nvarchar(10) not null,
	d_bedno nvarchar(10) not null,
	s_phone nvarchar(20) not null
);
go
EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'宿舍信息表', 
	@level0type=N'SCHEMA',@level0name=N'dbo', 
	@level1type=N'TABLE',@level1name=N'Dormitory';
go
EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'自增ID' ,
	@level0type=N'SCHEMA',@level0name=N'dbo', 
	@level1type=N'TABLE',@level1name=N'Dormitory', 
	@level2type=N'COLUMN',@level2name=N'id';
go
EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'学号' ,
	@level0type=N'SCHEMA',@level0name=N'dbo', 
	@level1type=N'TABLE',@level1name=N'Dormitory', 
	@level2type=N'COLUMN',@level2name=N's_no';
go
EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'姓名' ,
	@level0type=N'SCHEMA',@level0name=N'dbo', 
	@level1type=N'TABLE',@level1name=N'Dormitory', 
	@level2type=N'COLUMN',@level2name=N's_name';
go
EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'性别 0:未知 1:男 2:女' ,
	@level0type=N'SCHEMA',@level0name=N'dbo', 
	@level1type=N'TABLE',@level1name=N'Dormitory', 
	@level2type=N'COLUMN',@level2name=N's_sex';
go
EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'班级' ,
	@level0type=N'SCHEMA',@level0name=N'dbo', 
	@level1type=N'TABLE',@level1name=N'Dormitory', 
	@level2type=N'COLUMN',@level2name=N's_class';
go
EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'系部' ,
	@level0type=N'SCHEMA',@level0name=N'dbo', 
	@level1type=N'TABLE',@level1name=N'Dormitory', 
	@level2type=N'COLUMN',@level2name=N's_dept';
go
EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'宿舍号' ,
	@level0type=N'SCHEMA',@level0name=N'dbo', 
	@level1type=N'TABLE',@level1name=N'Dormitory', 
	@level2type=N'COLUMN',@level2name=N'd_doorno';
go
EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'床号' ,
	@level0type=N'SCHEMA',@level0name=N'dbo', 
	@level1type=N'TABLE',@level1name=N'Dormitory', 
	@level2type=N'COLUMN',@level2name=N'd_bedno';
go
EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'手机号' ,
	@level0type=N'SCHEMA',@level0name=N'dbo', 
	@level1type=N'TABLE',@level1name=N'Dormitory', 
	@level2type=N'COLUMN',@level2name=N's_phone';
go